package com.example.edu_service.controller;


import com.example.commonutils.R;
import com.example.edu_service.entity.subject.One;
import com.example.edu_service.service.EduSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2021-07-31
 */
@RestController
@RequestMapping("/edu_service/edu_subject")

public class EduSubjectController {

    @Autowired
    private EduSubjectService eduSubjectService;

    @PostMapping("addSubject")
    public R addSubject(MultipartFile file){

        eduSubjectService.saveSubject(file,eduSubjectService);
        return R.ok();
    }

    @GetMapping("getAllSubject")
    public R getAllSubject(){

        List<One> list=eduSubjectService.getAllSubject();
        return R.ok().data("list",list);
    }

}

